import Vue from 'vue';
import Router from 'vue-router';
const index = resolve => require(['../components/page/index.vue'], resolve) //系统首页
const intergal = resolve => require(['../components/page/intergal.vue'], resolve) //订单管理
const msg = resolve => require(['../components/page/msg.vue'], resolve) //消息管理
const competition = resolve => require(['../components/page/competition/competition.vue'], resolve) //赛事管理
const table = resolve => require(['../components/page/BaseTable.vue'], resolve) //基础表格
const tabs = resolve => require(['../components/page/Tabs.vue'], resolve) //tab选项卡
const form = resolve => require(['../components/page/BaseForm.vue'], resolve) //基本表单
const editor = resolve => require(['../components/page/VueEditor.vue'], resolve) //富文本编辑器
const charts = resolve => require(['../components/page/BaseCharts.vue'], resolve) //schart图表
const markdown = resolve => require(['../components/page/Markdown.vue'], resolve) //markdown编辑器
const upload = resolve => require(['../components/page/Upload.vue'], resolve) //文件上传
const drag = resolve => require(['../components/page/DragList.vue'], resolve) //拖拽列表
const permission = resolve => require(['../components/page/Permission.vue'], resolve) //权限测试
const login = resolve => require(['../components/page/Login.vue'], resolve) //登录
const addCompetition = resolve => require(['../components/page/competition/addCompetition.vue'], resolve) //新增赛事
const matchDetails = resolve => require(['../components/page/competition/matchDetails.vue'], resolve) //查看赛事
const matchEdit = resolve => require(['../components/page/competition/matchEdit.vue'], resolve) //编辑赛事


Vue.use(Router);

export default new Router({
    routes: [
        { path: '/', redirect: '/index', meta: { title: '首页' }, },
        {
            path: '/', component: resolve => require(['../components/common/Home.vue'], resolve), meta: { title: '自述文件' },
            children: [
                { path: '/index', name: 'index', component: index, meta: { title: '系统首页' } },
                { path: '/intergal', name: 'intergal', component: intergal, meta: { title: '订单管理' } },
                { path: '/msg', name: 'msg', component: msg, meta: { title: '消息管理' } },
                { path: '/competition', name: 'competition', component: competition, meta: { title: '赛事管理' } },
                { path: '/table', name: 'table', component: table, meta: { title: '基础表格' } },
                { path: '/tabs', name: 'tabs', component: tabs, meta: { title: 'tab选项卡' } },
                { path: '/form', name: 'form', component: form, meta: { title: '基本表单' } },
                { path: '/editor', name: 'editor', component: editor, meta: { title: '富文本编辑器' } },
                { path: '/markdown', name: 'markdown', component: markdown, meta: { title: 'markdown编辑器' } },
                { path: '/upload', name: 'upload', component: upload, meta: { title: '文件上传' } },
                { path: '/charts', name: 'charts', component: charts, meta: { title: 'schart图表' } },
                { path: '/drag', name: 'drag', component: drag, meta: { title: '拖拽列表' } },
                { path: '/permission', name: 'permission', component: permission, meta: { title: '权限测试', permission: true } },
                { path: '/addCompetition', name: 'addCompetition', component: addCompetition, meta: { title: '新增赛事'} },
                { path: '/matchDetails', name: 'matchDetails', component: matchDetails, meta: { title: '查看赛事'} },
                { path: '/matchEdit', name: 'matchEdit', component: matchEdit, meta: { title: '编辑赛事'} },
            ]
        },
        { path: '/login', name: 'login', component: login, meta: { title: '登录' } },
        { path: '/404', component: resolve => require(['../components/page/404.vue'], resolve) },
        { path: '/403', component: resolve => require(['../components/page/403.vue'], resolve) },
        { path: '*', redirect: '/404' },
    ]
})
